<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/8
 * Time: 23:57
 */

namespace Admin\Controller;

use Common\Controller\AdminController;
use Think\Page;

class AdminPowerController extends AdminController
{
    public function index()
    {
        $keyword = I('get.keyword','','htmlspecialchars');
        $search = I('get.search');
        $Admin = M('AdminRolePowerView');
        if (!empty($search)) {
            $where['role_name']  = array('eq',$search); //用户角色名称
        }

        if (!empty($keyword)) {

            $where['admin_id|real_name']  = array('like', "%$keyword%");
        }

        $dataCount = $Admin->where($where)->count();

        $page = new Page($dataCount, 10);
        $show = $page->show();

        $data = $Admin->where($where)->limit($page->firstRow, $page->listRows)->select();

        $this->assign('data',$data);
        $this->assign('show',$show);


        layout(true);
        $this->display('index');
    }

    /*
     * 修改用户权限
     * */
    public function modPower()
    {
        layout(true);
        $this->display('add_power');
    }

}